package br.com.minhascontas.controller;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import br.com.example.minhascontas.R;
import br.com.minhascontas.model.MenuListView;

public class ListViewMenuInicial extends BaseAdapter{
	
	private Context context;
	private List<MenuListView> clsMenus;
	
	public ListViewMenuInicial(Context context, List<MenuListView> clsMenus){
		this.context = context;
		this.clsMenus = clsMenus;

	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return clsMenus.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return clsMenus.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		
		MenuListView clsMenu = clsMenus.get(position);
		
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View v = inflater.inflate(R.layout.listview_menu_inicial, null);
		
		
		TextView txtLink = (TextView) v.findViewById(R.id.txtLink);
		
		txtLink.setText(clsMenu.getStrNome());

	//	for(int i = 0; i < clsMenu.size(); i++){
	//		txtLink.setText((CharSequence) clsMenu.get(i));
	//	}
		
		
		return v;
	}

}
